package com.bdqn.config;

import com.bdqn.intereceptior.Authentication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class JavaConfig implements WebMvcConfigurer {
    /**
     * 不拦截的路径  --------------------------
     */
    private static final  String[] EXCLUDE={
            "/employee/login",
            "/backend/api/**",
            "/backend/images/**",
            "/backend/js/**",
            "/backend/plugins/**",
            "/backend/styles/**",
            "/backend/page/login/login.html",
            "/front/page/login.html",
            "/front/api/**",
            "/front/images/**",
            "/front/js/**",
            "/front/plugins/**",
            "/front/styles/**",
            "/user/login",
            "/front/page/login.html",
            "/user/sendMsg"
    };
    @Autowired
    private Authentication authentication;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(authentication).addPathPatterns("/**").excludePathPatterns(EXCLUDE);
    }
}
